#include <stdio.h>
#include "progressbar.h"
#include <unistd.h>

typedef void (*callback_f)(int);

void download(callback_f cb){
    int total= 1000;
    int cur = 0;
    while(cur <= total){
        int rate = cur * 100 / total;
        //回调函数继续调用进度条显示 
        cb(rate);
        //延迟时间
        usleep(50000);
        //修改cur
        cur += 10;
    }
    printf("\n");
    initbar();
}

int main(){
    download(progressbar);
    return 0;
}
